🐛 fix appsec bypass with invalid content-length#321
Merged
Conversation
mathieuHa
approved these changes
Apr 26, 2026
Collaborator
mathieuHa
left a comment
There was a problem hiding this comment.
This looks good to me
HTTP/1.1 allows chunked transfer encoding, where Content-Length is absent or misleading. An attacker can craft a request with a body but no valid Content-Length, and the code before would skip AppSec analysis completely on that body. This could be an AppSec bypass vector.
A bit of context for users:
An attacker could bypass AppSec inspection entirely by sending a request with a body but setting Content-Length: 0 (or omitting the header entirely, which defaults to -1 in Go's http.Request). Since ContentLength <= 0 was falsy in the condition, the body would never be forwarded to AppSec for analysis, even though it contained potentially malicious payload.
renovate Bot
added a commit
to sdwilsh/ansible-playbooks
that referenced
this pull request
Apr 28, 2026
…plugin to v1.6.0 ##### [\`v1.6.0\`](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/releases/tag/v1.6.0) #### What's Changed - 📝 Update README.md to show simplified dynamic configuration by [@cliffjao](https://github.com/cliffjao) in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) - 🔊 Improve Logging: move to slog and add trace level by [@david-garcia-garcia](https://github.com/david-garcia-garcia) in [#276](maxlerebourg/crowdsec-bouncer-traefik-plugin#276) - 🐛 fix appsec bypass with invalid content-length by [@maxlerebourg](https://github.com/maxlerebourg) in [#321](maxlerebourg/crowdsec-bouncer-traefik-plugin#321) #### New Contributors - [@cliffjao](https://github.com/cliffjao) made their first contribution in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) **Full Changelog**: <maxlerebourg/crowdsec-bouncer-traefik-plugin@v1.5.1...v1.6.0>
renovate Bot
added a commit
to sdwilsh/ansible-playbooks
that referenced
this pull request
Apr 30, 2026
…plugin to v1.6.0 ##### [\`v1.6.0\`](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/releases/tag/v1.6.0) #### What's Changed - 📝 Update README.md to show simplified dynamic configuration by [@cliffjao](https://github.com/cliffjao) in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) - 🔊 Improve Logging: move to slog and add trace level by [@david-garcia-garcia](https://github.com/david-garcia-garcia) in [#276](maxlerebourg/crowdsec-bouncer-traefik-plugin#276) - 🐛 fix appsec bypass with invalid content-length by [@maxlerebourg](https://github.com/maxlerebourg) in [#321](maxlerebourg/crowdsec-bouncer-traefik-plugin#321) #### New Contributors - [@cliffjao](https://github.com/cliffjao) made their first contribution in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) **Full Changelog**: <maxlerebourg/crowdsec-bouncer-traefik-plugin@v1.5.1...v1.6.0>
sdwilsh
pushed a commit
to sdwilsh/ansible-playbooks
that referenced
this pull request
Apr 30, 2026
…plugin to v1.6.0 ##### [\`v1.6.0\`](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/releases/tag/v1.6.0) #### What's Changed - 📝 Update README.md to show simplified dynamic configuration by [@cliffjao](https://github.com/cliffjao) in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) - 🔊 Improve Logging: move to slog and add trace level by [@david-garcia-garcia](https://github.com/david-garcia-garcia) in [#276](maxlerebourg/crowdsec-bouncer-traefik-plugin#276) - 🐛 fix appsec bypass with invalid content-length by [@maxlerebourg](https://github.com/maxlerebourg) in [#321](maxlerebourg/crowdsec-bouncer-traefik-plugin#321) #### New Contributors - [@cliffjao](https://github.com/cliffjao) made their first contribution in [#313](maxlerebourg/crowdsec-bouncer-traefik-plugin#313) **Full Changelog**: <maxlerebourg/crowdsec-bouncer-traefik-plugin@v1.5.1...v1.6.0>
mathieuHa
added a commit
that referenced
this pull request
Jun 6, 2026
A bidirectional gRPC stream is an HTTP/2 request with no Content-Length whose body never reaches EOF. Since #321 removed the ContentLength guard, appsecQuery buffered it with io.ReadAll, which blocked until the request timed out and was turned into a 403 (issue #323). The backend was never reached (OriginStatus:0). Mirror the reference lua-cs-bouncer behaviour: detect an unreadable body (ProtoMajor >= 2 && ContentLength < 0) and, instead of buffering it, forward the request to Appsec with headers only. Add a new CrowdsecAppsecDropUnreadableBody option (default false) that mirrors the reference APPSEC_DROP_UNREADABLE_BODY: when true, such requests are blocked outright instead of forwarded without their body. Readable HTTP/1.1 bodies are still buffered and inspected, so the bypass closed by #321 stays closed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.